﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Net.Security;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading.Tasks;

namespace Sec_scan安全漏洞扫描系统_2._0.Services_Class
{
    internal class Tl_CustomHttpClient_Class
    {
        private static readonly HttpClient _httpClient;
        /// <summary>
        /// 封装解决ssl证书的问题
        /// </summary>
        static Tl_CustomHttpClient_Class()
        {
            var handler = new HttpClientHandler
            {
                ServerCertificateCustomValidationCallback = (HttpRequestMessage req, X509Certificate2 cert, X509Chain chain, SslPolicyErrors errors) => true
            };

            _httpClient = new HttpClient(handler);
        }

        /// <summary>
        /// 提供一个获取 HttpClient 实例的方法
        /// </summary>
        public static HttpClient Instance => _httpClient;
    }
}
